{% extends 'base.html' %}

{% block scripts %}
  {{ block.super }}
  <script type="text/javascript">
    addMessageUrl="{% url core.views.event.add_message discussion.id %}";
  </script>
{% block styles %}
{{ block.super }}
<link rel="stylesheet" type="text/css" title="style" href="{{ STATIC_URL }}css/event.css" />
{% endblock %}

	<script type="text/javascript" src="{{ STATIC_URL }}js/discussion.js"></script>
{% endblock %}

{% block content %}
  <div id="discussion_content">
    <div class="message_box">
      <h2 id="discussion_title">"{{ discussion.name }}"  в <a href="{% url core.views.event.details discussion.event.id %}">{{ discussion.event.name }}</a></h2> 
      {% for message in messages %}
        <ul id="messages">
          <div class="message">
            <li id="message_author">
              {{ message.author }}
            </li>
          </div>
          <li id="message_text">{{ message.text }}</li>
          <li id="message_datetime"><span>{{ message.datetime }}</span></li>
        </ul>
      {% endfor %}
    </div>
  
    {% if message_form %}
    <form id="message_form" action="" method="post" enctype="multipart/form-data">
      {{ message_form.text }}
      <input id="add_message" class="btn gray" type="button" onclick="sendMessage();" value="Добавить" />
      <input type="hidden" value="{{ user.name }}" id="user_name" />
    </form>
    {% endif %}
  </div>
{% endblock %}
